package com.etone.autotesting.support;

import java.io.FileNotFoundException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Map;

import org.apache.log4j.PropertyConfigurator;

import com.etone.autotesting.manager.impl.ConditionSearchManager;

public class TestServer {

    static {
        String logPath = ClassLoader.getSystemResource("META-INF/log4jUdp.properties").getPath();
        // 单独运行时的文件
        // logPath = "cfg\\log4jUdp.properties";
        System.out.println(logPath);
        PropertyConfigurator.configure(logPath);
    }

    public static void main(String[] args) throws FileNotFoundException, Exception {
        // SocketService service = new SocketService();
        // service.startNettyService();        
       
        InputStream stream = ClassLoader.getSystemResourceAsStream("META-INF//Parameter.js");
        int length = stream.available();
        byte[] fileByte = new byte[length];
        stream.read(fileByte);
        String jsonString = new String(fileByte);
        ConditionSearchManager manager = new ConditionSearchManager();
        manager.addFunctionCondition(jsonString);
    }

    private static void getSystemProperty() {
        Iterator<Map.Entry<Object, Object>> propertiesSet = System.getProperties().entrySet().iterator();
        while (propertiesSet.hasNext()) {
            Map.Entry<java.lang.Object, java.lang.Object> entry = (Map.Entry<java.lang.Object, java.lang.Object>) propertiesSet.next();
            System.out.println(entry.getKey() + "," + entry.getValue());
        }
    }
}
